package com.medicine.controller;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import pagination.Page;
import po.Rkxx;
import requestvo.ApplyRepairReqVo;
import requestvo.ApplyRepairReqVo;
import requestvo.RkxxReqVo;

@Controller
public class ApplyRepairController extends BaseController{	
	@RequestMapping("/sbbxxx")
	public void findRkxx(ApplyRepairReqVo applyRepairReqVo ,HttpServletResponse response) throws IOException{
		Page<ApplyRepairReqVo> page=applyRepairService.findsbbxxx(applyRepairReqVo);
		JSONObject jsonObject=new JSONObject();
		jsonObject.element("rows", page.getResults());
		jsonObject.element("total", page.getTotalRecord());
		response.setCharacterEncoding("UTF-8");  
		response.setContentType("application/json; charset=utf-8");  
		response.getWriter().print(jsonObject.toString());
		
	}
	@RequestMapping("/updatesbbxxx")
	public void updatesbbfxx(ApplyRepairReqVo applyRepairReqVo,HttpServletResponse response) throws IOException{
		applyRepairService.updatesbbxxx(applyRepairReqVo);
		response.sendRedirect("sb_baofei.html");
	}
	
	@RequestMapping("/addsbbxxx")
	public void addsbbfxx(ApplyRepairReqVo applyRepairReqVo,HttpServletResponse response) throws IOException{	
		applyRepairService.addsbbxxx(applyRepairReqVo);
		response.sendRedirect("sb_baofei.html");
	}
	
	@RequestMapping("/delsbbxxx")
	public void delsbbfxx(String ids,HttpServletResponse response) throws IOException{
		String[] id=ids.split(",");
		Integer[] integers=new Integer[id.length];
		for(int i=0;i<id.length;++i)
			integers[i]=Integer.parseInt(id[i]);
		applyRepairService.delsbbxxx(integers);
		response.sendRedirect("sb_baofei.html");
	}
	
	
}
